Skip to content

SOLR-18300 : Update apache.kafka to V4#4610

Open
jaykay12 wants to merge 19 commits into
apache:mainfrom
jaykay12:SOLR-18300-update-kafka-v4
Open

SOLR-18300 : Update apache.kafka to V4#4610
jaykay12 wants to merge 19 commits into
apache:mainfrom
jaykay12:SOLR-18300-update-kafka-v4

Conversation

@jaykay12

@jaykay12 jaykay12 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18300

Description

This branch is checked-out from the branch which solrbot created.
This PR is a superset of #3274 (-> can be closed once this is merged)

Package Type Update Change
org.apache.kafka:kafka-streams dependencies major 3.9.2 → 4.3.1
org.apache.kafka:kafka-server-common dependencies major ❌ (Removed)
org.apache.kafka:kafka_2.13 dependencies major ❌ (Removed)
org.apache.kafka:kafka-clients dependencies major 3.9.2 → 4.3.1
org.testcontainers:testcontainers-kafka dependencies major ✅ (Added) 2.0.5

There were few major & significant changes introduced in apache.kafka v4, which are being done in this PR alongside the normal version bumps.

Solution

We were using EmbeddedKafkaCluster which in V4 is no longer supported.
Went ahead with the TestContainer approach & updated all tests in cross-dc-manager module accordingly.

AI Usage Disclosure - Used Gemini Chat (3.5 Flash) - for the guidance & code snippets.

Tests

./gradlew check -x test -> ✅

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

@jaykay12 jaykay12 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review ✅

for (TopicPartition topicPartition : topicPartitions) {
if (topicPartition.topic().equals(topic)) {
long endOffset = consumer.position(topicPartition);
long committedOffset = consumer.committed(topicPartition).offset();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/apache/solr/actions/runs/28428066221/job/84235821648 , Simply updating the version was giving compilation error.

Image

Evidences for supporting this change:

Image

Comment thread gradle/libs.versions.toml
apache-httpcomponents-httpcore = { module = "org.apache.httpcomponents:httpcore", version.ref = "apache-httpcomponents-httpcore" }
apache-httpcomponents-httpmime = { module = "org.apache.httpcomponents:httpmime", version.ref = "apache-httpcomponents-httpmime" }
apache-kafka-clients = { module = "org.apache.kafka:kafka-clients", version.ref = "apache-kafka" }
apache-kafka-kafka213 = { module = "org.apache.kafka:kafka_2.13", version.ref = "apache-kafka" }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Comment on lines +277 to +281
// Global override for local integration testing
grant {
permission java.security.AllPermission;
};

@jaykay12 jaykay12 Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pending-to-discuss] with reviewer on the right way here. This works, but this is surely not the right way.

This is required to resolve this error, which comes in the cross-dc-manager test which interacts with the kafka container which runs on docker daemon.

Image

Comment thread gradle/libs.versions.toml
swagger3-jaxrs2-jakarta = { module = "io.swagger.core.v3:swagger-jaxrs2-jakarta", version.ref = "swagger3" }
tdunning-tdigest = { module = "com.tdunning:t-digest", version.ref = "tdunning-tdigest" }
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
testcontainers-kafka = { module = "org.testcontainers:testcontainers-kafka", version.ref = "testcontainers" }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Since Kafka 4.x fully supports lightweight, fast KRaft startups, the cleanest modern approach is to spin up an ephemeral Docker container using Testcontainers. It completely isolates Kafka from the JVM running Solr. [Industry standards]

@markrmiller

Copy link
Copy Markdown
Member

Just curious: what motivated the upgrade?

@jaykay12

jaykay12 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Just curious: what motivated the upgrade?

I came across this thread: https://lists.apache.org/thread/fkb9dgtybbjz4f5jzk6qb6ysh18bt5n5 by @janhoy asking for help in getting upgrades done & I landed upon the PR: #3274 that was raised by solrbot initially some 1 year back & was still pending. I thought of taking it to closure.

Since there were major changes that were required, I created Jira & started working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants